package com.killer.controller;

import com.killer.common.ResponseBuilder;
import com.killer.pojo.Resume;
import com.killer.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("resume")
public class ResumeController {

    @Autowired
    private ResumeService resumeService;

    @RequestMapping("/listAll")
    @ResponseBody
    public Object listAllResumes() {
        List<Resume> resumes = resumeService.listAllResumes();
        return new ResponseBuilder().success().data(resumes).build();
    }

    @RequestMapping("/addResume")
    @ResponseBody
    public Object addResume(Resume resume) {
        resumeService.addResume(resume);
        return new ResponseBuilder().success().build();

    }

    @RequestMapping("/deleteResume")
    @ResponseBody
    public Object deleteResume(Long id) {
        resumeService.deleteResume(id);
        return new ResponseBuilder().success().build();

    }
}
